package xxy.com.yangproject.database.Dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.RoomWarnings;

import java.util.List;

import javax.sql.DataSource;

import xxy.com.yangproject.database.Entity.Cheese;

@Dao
public interface CheeseDao {
//    @Query("SELECT * FROM cheese ORDER BY name COLLATE NOCASE ASC")   //COLLATE NOCASE :忽略大小写   ASC:升序
//    @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
//    DataSource allCheesesByName();

    @Insert
    void insertList(List<Cheese> cheeses);

    @Insert(onConflict = OnConflictStrategy.REPLACE)   //冲突策略是取代旧数据同时继续事务
    void insert(Cheese cheese);

    @Delete
    void delete(Cheese cheese);
}

